package demo1;

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i<n; i++) {
            arr[i] = scanner.nextInt();
        }
        int index = 0;

        List<Integer> a = new LinkedList<>();
        List<Integer> b = new LinkedList<>();
        List<List<Integer>> ret = new LinkedList<>();
        a.add(arr[index++]);
        while(index < n) {
            int c = arr[index++];
            if(c < a.get(a.size()-1)) {
                a.add(c);
            }else {
                if(b.isEmpty() || c > b.get(b.size()-1)) {
                    b.add(c);
                }else {
                    ret.add(a);
                    a = new LinkedList<>();
                    for(int i = 0; i<b.size(); i++) {
                        if(b.get(i) > c) {
                            a.add(b.get(i));
                            b.remove(i);
                            i--;
                        }
                    }
                    a.add(c);
                }
            }
        }

        if(!a.isEmpty()) ret.add(a);
        if(!b.isEmpty()) ret.add(b);

        int res1 = ret.size();
        int res2 = Integer.MIN_VALUE;
        for(int i = 0; i<res1; i++) {
            res2 = Math.max(res2, ret.get(i).size());
        }
        System.out.println(res1 + " " + res2);
    }
}
